axios.get('/index/index').then(({data:{data}}) => {
    const {sideBanner,allTag, allLink} = data
    // 右边侧边栏
    const nofollowLi = sideBanner.map(({advimglink, advimgdesc, advimgsrc}) => {
        // console.log(res)
        return `
        <a href="${advimglink}" rel="nofollow" target="_blank" title="${advimgdesc}">
            <img class="g430" style="width:360px;height:133px;" src="http://124.223.14.236:8060/${advimgsrc}" alt="阿里云开学季" >
        </a>`
    }).join('')
    $('.textwidget').html(nofollowLi)

    // 热门标签
    const biaoqian = allTag.map(({id, tagname}) => {
        // console.log(res)
        return `<li><a title="" href="" id="${id}">${tagname}</a></li>`
    }).join('')
    $('.widget_tags_inner').html(biaoqian)

    // 友情链接部分
    const frend = allLink.map(({url, img, title, des}) => {
        // console.log(res)
        return `
        <li>
        <a href="${url}"><img src="http://124.223.14.236:8060/${img}" alt="" title="${title}">
          <p>${des}</p>
        </a>
      </li>`
    }).join('')

    $('.widget_comments ul').html(frend)
})

// 热门文章部分
axios.get('/index/recommend').then(({data:{data}}) => {
    // console.log(data)
    const {list} = data
    const rewen = list.map(({pic, title, click}) => {
        // console.log(res)
        return `
        <li>
        <a target="_blank" href="">
          <span class="thumbnail">
            <img src="http://124.223.14.236:8060/${pic}" class="thumb" />
          </span>
          <span class="text">${title}</span>
          <span class="text-muted post-views">阅读(${click})</span>
        </a>
      </li>`
    }).join('')

    $('.widget_postlist .items-02').html(rewen)
})